﻿/********************************************************************************/
// <copyright file="DefaultConfigurationReader.cs" company="Asia E-Business Solutions">
//     Copyright © 2012. All right reserved
// </copyright>
//
// <history>
//  <change who="Hieu Nguyen" date="11/12/2012 11:59:11 AM">Created</change>
// <history>
/********************************************************************************/

namespace JLL.China.Infrastructure.Configuration
{
    using System;
    using System.Configuration;

    /// <summary>
    /// An implementation of IConfigurationReader which can read web.config and app.config
    /// </summary>
    public class DefaultConfigurationReader : IConfigurationReader
    {
        #region -- IConfigurationReader Members --

        /// <summary>
        /// Gets the error message.
        /// </summary>
        /// <value>The error message.</value>
        public string ErrorMessage
        {
            get
            {
                return "{0} configuration is missing or incorrect from you web.config. It should contain  <appSettings><add key=\"{0}\" value=\"{1}\" /></appSettings> ";
            }
        }

        /// <summary>
        /// Reads the configuration.
        /// </summary>
        /// <param name="configurationKeyname">The configuration keyname.</param>
        /// <returns></returns>
        public string ReadConfiguration(string configurationKeyname)
        {
            return ConfigurationManager.AppSettings[configurationKeyname];
        }

        #endregion
    }
}
